<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" href="ckpasschat.css" type="text/css" charset="utf-8" />
        <title></title>
    </head>
    
    <div id="ckform">
      <!--image here...-->
    </div>
    <form method="POST">
        <div class="ckpassbox">
            <input type="password" name="passascessroom" value="" size="65"/>
        </div>
        <div id="okckpassbox">
            <input type="submit" value="        OK        " />
        </div>
        
    </form>
    <form method="POST" action="roomlist.php">
        <div id="quitpassbox">
            <input type="submit" value="       Qiut       "/>
        </div>
    </form>
    
    <body>
        <div id="statusphp">
<?php
            //echo "you're Here";
            $ask="0";
            $roomname=$_GET['roomname'];
            //echo $roomname;
            $passck=$_POST['passascessroom'];

            $link = mysql_connect("localhost","root","");
            mysql_select_db("ilink");

            //echo ("SELECT * FROM createroom where roomname=$roomname");

            //echo ("SELECT roompassword FROM createroom where roomname =$items");
            $result = mysql_query("SELECT roompassword FROM createroom where roomname ='$roomname'");

            while($linex = mysql_fetch_array($result)){
                  //echo "<email>".$linex['roompassword']."<br>";

                  if($linex['roompassword']==$passck){

                            echo "join chatroom.";
                            $ask="1";

                        }
                        else{
                            echo "Type password or Quit.";
                        }
                   }


            mysql_close($link);
            ?>
</div>
        <script type="text/javascript">
            var jsvar=<?php echo $ask; ?>;
            //alert(jsvar);
            if(jsvar=="1"){
                //alert("pass");
                setTimeout(function(){location.href = "http://localhost/WebiLink/chat.php?roomname=<?php echo $roomname ?>";},1000);
            }
        </script>
    </body>
</html>
